package com.horizon.common.entity;

import com.horizon.common.util.IDGenerator;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;

/**
 * 通用实体类，集成该类可获取主键
 *
 * @author wangfuwei
 * @version 2018-08-07
 */
@Getter
@Setter
@MappedSuperclass
public abstract class BaseEntityNoAudit implements IBaseEntity {

    /**
     * 主键
     */
    @Column(name = "fd_id", length = 32)
    @Id
    protected String fdId = IDGenerator.generateID();

    /**
     * 重新生成主键
     */
    protected void newId() {
        setFdId(IDGenerator.generateID());
    }
}